package com.nicy.molly.biz;

import com.nicy.molly.utils.annotation.NeedLogin;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;

/**
 * @description:
 * @projectName:molly
 * @see:com.nicy.molly.biz
 * @author:NicyYe
 * @createTime:2021/2/22 16:21
 * @version:1.0
 */
@CrossOrigin
@RestController
public class HelloController {

    /**
     * 测试不 需要登录
     *
     *
     */
    @RequestMapping("/testNoLogin")
    public String testNoLogin (HttpSession session){
        session.setAttribute("token","login");
        return "调用成功，此接口不需要登录校验!";
    }

    /**
     * 测试需要登录
     *
     *
     */
    @NeedLogin
    @RequestMapping("/testNeedLogin")
    public String testNeedLogin (){
        return "testNeedLogin！";
    }
}
